================================================================================
README 
================================================================================

Paper:    From Barriers to Abuse: Border Hardening and Torture
Authors:  Gino Pauselli and Beth A. Simmons
Journal:  International Organization
Year:     2026

This README describes the replication materials for the paper. All statistical
analyses were conducted in R. The replication package contains four R scripts,
five RDS data files, and two shapefiles. Running the scripts in order (1 through 4) 
reproduces all tables and figures in the paper and online appendix.

--------------------------------------------------------------------------------
SOFTWARE REQUIREMENTS
--------------------------------------------------------------------------------

R (version 4.0 or higher is recommended).

The following packages are required across the four scripts. Most are installed
automatically via pacman::p_load(); the sensemakr package must be installed
from GitHub as shown at the top of script 1.

  From CRAN:      readxl, haven, dplyr, ggplot2, ggcorrplot, fixest,
                  modelsummary, sensemakr, AER, ivDiag, did, stargazer,
                  tidyr, scales, stm, sf, rnaturalearthlwgeom, lwgeom,
                  tmap, pacman

  From GitHub:    sensemakr (jpmam1/sensemakr)
                  Install with: devtools::install_github("jpmam1/sensemakr")

--------------------------------------------------------------------------------
DATA FILES
--------------------------------------------------------------------------------

The following files must be present in the working directory before running
the scripts (except where noted for script 3, which uses shapefiles):

- master_df.rds: Main country-year panel dataset. Used by script 1.
- walls_year.rds: Yearly wall counts for Figure 2. Used by script 1.
- stm_master_df.rds: Document-level dataset for the STM. Used by script 2.
- stm_kResult.rds: Pre-computed STM model-selection diagnostics (exclusivity and 
semantic coherence across K = 2–20). Used by script 2.
- personnel_master_df.rds: US Customs and Border Protection personnel dataset.
Used by script 4.

- land_borders.shp: Shapefile of land borders. Used by script 3.
- europe_walls.shp: Shapefile of European border walls. Used by script 3.

--------------------------------------------------------------------------------
SCRIPT DESCRIPTIONS
--------------------------------------------------------------------------------

1_main_analysis.R
  Main empirical analysis. Produces all tables and figures related to the
  border wall–torture relationship using country-year panel data.

  Tables produced:
    Table 1          — BIO torture and general torture patterns (OLS/FE)
    Table 2          — Main OLS results: wall construction and BIO torture
    Table 3          — Instrumental variable (2SLS) results
    Table A.1        — Adjusted R² comparison with random-variable placebo
    Table A.2        — Bivariate models by agent type
    Table A.3        — Models with neighbor-country covariates
    Table A.5        — Robustness: asylum seekers
    Table A.6        — Robustness: border infrastructure
    Table A.7        — Robustness: visa policy
    Table A.8        — Wall and border infrastructure jointly
    Table A.9        — Wall × CSO repression interaction
    Table A.10       — Robustness: logit models
    Table A.11       — Robustness: Poisson models
    Table A.12       — Robustness: negative binomial models
    Table A.13       — Robustness: 3-year wall effect
    Table A.14       — Placebo tests (agent-type outcomes)
    Table A.15       — Difference-in-differences (Callaway & Sant'Anna)
    Table A.16       — IV first stage and diagnostics (F-stat, Wald, AR tests)

  Figures produced:
    Figure 1         — Torture trend over time (V-Dem)
    Figure 2         — BIO torture and border walls over time (dual axis)
    Figure 3         — DiD event-study plot
    Figure A.1       — Correlation matrix of BIO torture variables
    Figure A.2       — Jackknife coefficient plot (leave-one-country-out)
    Figure A.3_1–9   — Omitted-variable sensitivity plots
    Figure A.4       — Distribution of BIO torture observations

  Runtime note: The ivDiag bootstrapping calls (nboots = 1000) and the
  Callaway & Sant'Anna DiD estimator (biters = 10000) are computationally
  intensive. Setting pl = TRUE in att_gt() enables parallel processing.

2_stm_analysis.R
  Structural Topic Model (STM) analysis of Frontex operational documents.
  Fits a 15-topic STM and estimates the relationship between border walls and
  topic prevalence.

  Tables produced:
    Table 4          — Wall effects on human-rights and security topic prevalence
    Table A.17       — Robustness: Mediterranean border control

  Figures produced:
    Figure 5         — Human rights vs. security topic trends over time
    Figure A.5_1–2   — Model selection: exclusivity and semantic coherence
    Figure A.6       — STM topic summary (top words and proportions)
    Figure A.7       — Topic correlation network

  Note: A seed is set (set.seed(25876)) to ensure reproducibility of the STM.
  The pre-fitted kResult object (stm_kResult.rds) is provided so replicators
  do not need to re-run the full searchK() procedure to reproduce Figures A.5.
  The STM itself (fit15k) is re-estimated from the processed documents.

3_europe_walls_figure.R
  Produces the European border wall map using shapefiles and the tmap and sf
  packages.

  Figures produced:
    Figure 4         — Map of European border walls and land borders

4_uscs_personnel_analysis.R
  Analyses the relationship between US border wall construction, border
  infrastructure, and US Customs and Border Protection personnel levels,
  and their association with BIO torture.

  Tables produced:
    Table A.18       — Wall/infrastructure and personnel levels
    Table A.19       — Personnel and BIO torture

--------------------------------------------------------------------------------
OUTPUT FILES
--------------------------------------------------------------------------------

All tables are saved as .html files (or .docx for script 4) in the working
directory. All figures are saved as .png files (or .pdf for Figure 4) in the
working directory.

--------------------------------------------------------------------------------
NOTES FOR REPLICATORS
--------------------------------------------------------------------------------

- Set your R working directory to the folder containing the data files before
  running any script.
- Scripts are self-contained and can be run independently.
- The p_load() function from the pacman package will automatically install any
  missing CRAN packages on first run.

================================================================================
